<?php 
if (!empty($this->flash_messages))
{
    foreach ($this->flash_messages as $flash_message)
    {
        echo '<div class="message">'.$flash_message.'</div>';
    }
}
?>
<h1 class="caption"><?php echo Zend_Registry::get('locale')->_('Nodes') ?></h1>


<?php if (!empty($this->nodes)) : ?>
    <?php foreach ($this->nodes as $node) : ?>
      <div class="node-item">
        <h2>
            <em class="date"><?php echo date('d.m.Y',strtotime($node->publish_date)) ?></em>
            <?php if (!empty($node->url_alias)) : ?>
                <a href="<?php echo $this->fixUrl('node/view/'.$node->url_alias) ?>"><?php echo htmlspecialchars($node->title) ?></a>
            <?php else : ?>
                <a href="<?php echo $this->fixUrl('node/id/'.$node->id) ?>"><?php echo htmlspecialchars($node->title) ?></a>
            <?php endif; ?> 
        </h2>
        <div><?php echo '<strong>'.Zend_Registry::get('locale')->_('Type').': </strong>'.$node->getType(); ?></div>
        <div><?php echo '<strong>'.Zend_Registry::get('locale')->_('Category').': </strong>'.$node->getCategory(); ?></div>
        <p><?php echo nl2br(strip_tags($node->short_text)) ?></p>
        <?php if (Zend_Registry::get('user')->canManage()) : ?>
        <div class="node-links">
            <a href="<?php echo $this->fixUrl('node/edit/'.$node->id) ?>"><?php echo Zend_Registry::get('locale')->_('Edit') ?></a>
            &nbsp;|&nbsp;
            <a class="delete" href="javascript:if(confirm('<?php echo Zend_Registry::get('locale')->_('Are you sure ?')?>')){window.location.href='<?php echo $this->fixUrl('node/delete/'.$node->id) ?>'}"><?php echo Zend_Registry::get('locale')->_('Delete') ?></a>
        </div>
        <?php endif; ?>
        <div class="clear"></div>
      </div>
    <?php endforeach; ?>
<?php endif; ?>

<?php echo $this->paginator ?>